package com.testmanager.testmananger.shuiyou.strCompare.mapper;

import com.testmanager.testmananger.shuiyou.strCompare.domain.SyCompareScriptKeyEntity;
import com.testmanager.testmananger.shuiyou.strCompare.domain.SySqlCompareScriptEntity;
import com.testmanager.testmananger.shuiyou.strCompare.dto.CompareScriptDto;

import java.util.List;

public class CompareScriptMappre {

    public static SySqlCompareScriptEntity toSqlCompareScriptEntity(CompareScriptDto compareScriptDto){

        return  new SySqlCompareScriptEntity()
                .setId(compareScriptDto.getId())
                .setStatus(compareScriptDto.getStatus())
                .setDestSql(compareScriptDto.getDestSql())
                .setSrcSql(compareScriptDto.getSrcSql())
                .setName(compareScriptDto.getName())
                .setProjectid(compareScriptDto.getProjectid())
                .setType(compareScriptDto.getType())
                .setComment(compareScriptDto.getComment())
                .setMouduleName(compareScriptDto.getMouduleName())
                .setScriptno(compareScriptDto.getScriptno());
    }


    public static CompareScriptDto toCompareScriptDto(SySqlCompareScriptEntity scriptEntity, List<SyCompareScriptKeyEntity> variables,List<SyCompareScriptKeyEntity> authors){
        return new CompareScriptDto()
                .setId(scriptEntity.getId())
                .setStatus(scriptEntity.getStatus())
                .setDestSql(scriptEntity.getDestSql())
                .setSrcSql(scriptEntity.getSrcSql())
                .setName(scriptEntity.getName())
                .setProjectid(scriptEntity.getProjectid())
                .setType(scriptEntity.getType())
                .setComment(scriptEntity.getComment())
                .setMouduleName(scriptEntity.getMouduleName())
                .setAuthors(authors)
                .setVariables(variables)
                .setCreateBy(scriptEntity.getCreateBy())
                .setDate(scriptEntity.getCreatedDate())
                .setScriptno(scriptEntity.getScriptno());
    }

}
